package org.example.controller;

import org.example.entity.Interviewrecord;
import org.example.models.R;
import org.example.service.InterviewrecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@RestController
@RequestMapping("/interviewrecord")
public class InterviewrecordController {
    @Autowired
    private InterviewrecordService interviewrecordService;

    //添加
    @RequestMapping("/insert")
    public R<Interviewrecord> insert(@RequestParam Interviewrecord interviewrecord) {
        boolean save = interviewrecordService.save(interviewrecord);
       return R.success(interviewrecord);
    }

    //根据身份和条件更新面试记录
    @PutMapping("/update")
    public R<Interviewrecord> update(@RequestBody Interviewrecord interviewrecord) {

        interviewrecord.setInterviewEndTime(new Date());
        interviewrecord.setInterviewType("线下");
        int i = interviewrecordService.updateInterviewRecordByIdAndConditions(interviewrecord);
        return R.success(interviewrecord);
    }
}
